from django.contrib.sitemaps import Sitemap
from nameremoved.comics.models import Comic
from datetime import datetime

class ComicSitemap(Sitemap):
    changefreq = "never"
    priority = 0.8
    
    def items(self):
        return Comic.public_comics.all()
    
    def lastmod(self, comic):
        return comic.date

class ContributionSitemap(Sitemap):
    changefreq = "weekly"
    priority = 0.6
    lastmod = datetime.today()
    
    def location(self, page):
        pages = {"front": "/contribute/",
            "contribs": "/contribute/list/"}
        return pages[page]
    
    items = lambda x: ("front", "contribs")